package CrowdCounting.Model.ComponentFactoryImp;

import CrowdCounting.Model.AbstractComponentFactory;

import javax.swing.*;
import java.awt.*;

public class ComponentFactory extends AbstractComponentFactory {
    @Override
    public Component getComponent(Component component, int width, int height, int x, int y, Color color, int fontSize) {
        component.setBounds(x, y, width, height);
        if (fontSize != 0) component.setFont(new Font(null, Font.BOLD, fontSize));
        if (color != null) component.setForeground(color);
        return component;
    }

    public JPanel getPaneDefault(int width, int height, int x, int y) {
        return getPane(width, height, x, y, 4, true);
    }

    @Override
    public JPanel getPane(int width, int height, int x, int y, int thickness, boolean rounded) {
        JPanel panel = new JPanel();
        panel.setLayout(null);
        panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, thickness, rounded));
        panel.setBounds(x, y, width, height);
        return panel;
    }

}
